home *** CD-ROM | disk | FTP | other *** search
/ Windows 6-Pak - Disc 4 / Windows 6-Pak (InfoMagic) (Disc 4) (1999).ISO / Text-Chat-Scripts / pp-320m.exe / pp300 / r-main.mrc < prev    next >
Text File  |  1998-10-10  |  28KB  |  620 lines

  1. ; -----------------------------------------------------
  2. ; Peace and Protection (by misspai)
  3. ; -----------------------------------------------------
  4. ; Main (common/misc) events file
  5. ; -----------------------------------------------------
  6. ; Miscellaneous cleanup on start,
  7. ; connect, and disconnect
  8. ; -----------------------------------------------------
  9. on 1:start:{
  10.   if (%whois.showcc == $null) %whois.showcc = $true
  11.   if (%sounds.halt == $null) %sounds.halt = $true
  12.   if (%pp.dodal == $null) %pp.dodal = $false
  13.   unset %pp.width %pp.height %pp.os %pp.fileman %pp.explore %pp.explore2
  14.   _writecfg Misc Group+ | _writecfg Misc Group-
  15.   _writecfg Misc Group^ | _writecfg Misc Group_
  16.   ; Verify mIRC version
  17.   if ($version < 5.41) { echo 4 -s You are NOT running mIRC 5.41! Peace and Protection requires mIRC 5.41 to run properly. | halt }
  18.   ; First time install
  19.   if (%pp.first == once) {
  20.     %pp.ver = v3.20.b
  21.     _gen-icf | rad
  22.     _2ndtime
  23.   }
  24.   elseif (%pp.first != no) {
  25.     if ($remove($gettok(%pp.ver,1-2,46),v) < 3.14) _fixupgrade
  26.     %pp.ver = v3.20.b
  27.     _gen-icf
  28.     set %.+ajl $true | _firsttime %pp.setuptype | halt
  29.   }
  30.   ; Upgrade?
  31.   if ($remove($gettok(%pp.ver,1-2,46),v) < 3.20) {
  32.     if ($remove($gettok(%pp.ver,1-2,46),v) < 3.14) _fixupgrade
  33.     _gen-icf
  34.     %pp.ver = v3.20.b
  35.     disps-div
  36.     disps Welcome to %col.target $+ Peace and Protection %pp.ver $+ !
  37.     disps-div
  38.   }
  39.   _dostartup
  40. }
  41. alias _fixupgrade {
  42.   _fixr ping.route | _fixr whois.route
  43.   _fixr snotice.route | _fixr wallop.route
  44.   _fixr event.route | _fixr notify.route
  45.   _fixr leech.route | _fixr motd.route
  46.   set %font.fixtab 20
  47.   set %pp.whois $_winpos(14%,7%,7%,9%)
  48.   set %pp.ping $_winpos(14%,7%,9%,7%)
  49.   unset %^snd.* %pp.dwidth %pp.dheight %+bantimerchk %_prvd %+nick.complete.anywhere %+nick.complete.globnotify %+dccincomp.remember %+awaylog.timestamp %font.fixed
  50.   set %pp.clock 0
  51.   set %pp.clock.beep $false
  52.   set %pp.clock.save $true
  53.   set %pp.clock.active $true
  54.   set %+flash.queryh $true
  55.   set %+flash.querya $false
  56.   set %+flash.msgh $false
  57.   set %+flash.msga $false
  58.   set %+flash.dcch $false
  59.   set %+flash.dcca $false
  60.   set %+desktopping $false
  61. }
  62. alias _dostartup {
  63.   ; Misc cleanup
  64.   set %self.lag ??
  65.   set %pp.net Offline
  66.   set %lastnum.send 0
  67.   if (%pp.clock.save == $false) set %pp.clock 0
  68.   ; Reset vars/groups
  69.   unset %_* %-* %s^* %.+icerr
  70.   set %_sndchange y | _dirstrucpop
  71.   .enable #^* #+*
  72.   .disable #_* #-*
  73.   ; Start timers
  74.   _timer924on
  75.   ; Clear autoevents  
  76.   set %.au.typ 1
  77.   :loopo
  78.   set %.au.bit $mid(jof,%.au.typ,1)
  79.   set %.au.var auto- $+ %.au.bit $+ .chans
  80.   set %.au.chans % [ $+ [ %.au.var ] ]
  81.   set %.au.num $_numtok(32,%.au.chans)
  82.   if (%.au.num > 0) {
  83.     set %.au.var auto- $+ %.au.bit $+ .exp
  84.     set %.au.glob % [ $+ [ %.au.var ] ]
  85.     :loopi
  86.     set %.au.chan $gettok(%.au.chans,%.au.num,32)
  87.     set %.au.var auto- $+ %.au.bit $+ . $+ %.au.chan $+ .exp
  88.     set %.au.loc % [ $+ [ %.au.var ] ]
  89.     if ((%.au.loc > 0) || ((%.au.loc == $null) && (%.au.glob > 0))) { auto %.au.bit $+ dq %.au.chan | set % [ $+ [ %.au.var ] ] }
  90.     if ($_vd(.au.num) > 0) goto loopi
  91.   }
  92.   if ($_vi(.au.typ) <= 3) goto loopo
  93.   ; Clear counters and recent files
  94.   _remcfg counter-e
  95.   _cleandc
  96.   _remcfg Gets | _remcfg Sends | _remcfg Files
  97.   if ($_ppcfg(Sound,AutoGetForget)) _remcfg AutoGet
  98.   ; Clear ignores
  99.   if ($_ppcfg(Misc,ClearIgnoreOnExit)) {
  100.     set %.ign $ignore(0)
  101.     if (%.ign > 0) {
  102.       :loopig
  103.       .ignore -r $ignore(%.ign)
  104.       if ($_vd(.ign) > 0) goto loopig
  105.     }
  106.   }
  107.   if (($version > 5.41) && (%pp.lastwarn != $version)) { set %pp.lastwarn $version | _error You are NOT running mIRC %col.att $+ 5.41 $+ ! P&P %pp.ver may not run properly on newer versions! See P&P help for info on getting updates. (you will not get this warning again) }
  108.   ; P&P integrity check
  109.   set %.ic.old1 $_ppcfg(Misc,Integrity1)
  110.   set %.ic.old2 $_ppcfg(Misc,Integrity2)
  111.   if ((%.ic.old1 !isnum) || (%.ic.old2 !isnum) || (%.ic.old1 < 1) || (%.ic.old2 < 1)) { set %.+icerr $true | disps %col.att $+ Integrity check- Integrity data corrupted or missing, no integrity check performed. }
  112.   else {
  113.     if ($alias(0) < %.ic.old1) { set %.+icerr $true | disps %col.att $+ Integrity check- %col.target $+ $calc(%.ic.old1 - $alias(0)) $+  %col.target $+ alias $+  file(s) that were previously loaded cannot be found }
  114.     if ($script(0) < %.ic.old2) { set %.+icerr $true | disps %col.att $+ Integrity check- %col.target $+ $calc(%.ic.old2 - $script(0)) $+  %col.target $+ script $+  file(s) that were previously loaded cannot be found }
  115.     if ($alias(0) > %.ic.old1) { set %.+icerr $true | disps %col.att $+ Integrity check- %col.target $+ $calc($alias(0) - %.ic.old1) $+  unrecognized %col.target $+ alias $+  file(s) found }
  116.     if ($script(0) > %.ic.old2) { set %.+icerr $true | disps %col.att $+ Integrity check- %col.target $+ $calc($script(0) - %.ic.old2) $+  unrecognized %col.target $+ script $+  file(s) found }
  117.   }
  118.   if (%.+icerr) { _gen-icf | disps Integrity files have been updated to not show these errors again. }
  119.   ; Verify sound index status
  120.   if (%+verify.indices) {
  121.     if (%+index.mp) {
  122.       set %.index $_ppdir $+ mp-list.txt
  123.       if ($exists(%.index)) {
  124.         set %.curr $read -l0 %.index
  125.         set %.ext $_maprev(mp2,*.) $+ ; $+ $_maprev(mp3,*.)
  126.         set %.num $_countfiles(%.ext,$_mpdir)
  127.         if (%.num != %.curr) {
  128.           if (%+dynrate.mp) disps Index file for MP2/3 files %col.att $+ outdated! (/mpindex to update)
  129.           else { disps Index file for MP2/3 files was %col.att $+ outdated! (updating...) | mpindex }
  130.         }
  131.       }
  132.       else {
  133.         if (%+dynrate.mp) disps Index file for MP2/3 files %col.att $+ not created! (/mpindex to create)
  134.         else { disps Index file for MP2/3 files was %col.att $+ not created! (creating...) | mpindex }
  135.       }
  136.     }
  137.     _vsis Wav /wavindex $_wavedir
  138.     _vsis Mid /midindex $_mididir
  139.     if (%soundfile.custom != $null) {
  140.       set %.tokn $_numtok(32,%soundfile.custom)
  141.       :loopvs
  142.       set %.type $gettok(%soundfile.custom,%.tokn,32)
  143.       _vsis $upper(%.type) /zindex $+ $chr(160) $+ %.type $_ppcfg(Sound, [ [ %.type ] $+ ] Dir)
  144.       if ($_vd(.tokn) > 0) goto loopvs
  145.     }
  146.   }
  147.   window -c @Progress
  148. }
  149. alias -l _vsis {
  150.   if (%+index. [ $+ [ $1 ] ] ) {
  151.     set %.index $_ppdir $+ $1 $+ -list.txt
  152.     if ($exists(%.index)) {
  153.       set %.curr $read -l0 %.index
  154.       set %.num $_countfiles($_maprev($1,*.),$3-)
  155.       if (%.num != %.curr) {
  156.         if (%+dynrate. [ $+ [ $1 ] ] ) disps Index file for $1 files %col.att $+ outdated! ( $+ $2 $+  to update)
  157.         else { disps Index file for $1 files was %col.att $+ outdated! (updating...) | $_f2s($2) }
  158.       }
  159.     }
  160.     else {
  161.       if (%+dynrate. [ $+ [ $1 ] ] ) disps Index file for $1 files %col.att $+ not created! ( $+ $2 $+  to create)
  162.       else { disps Index file for $1 files was %col.att $+ not created! (creating...) | $_f2s($2) }
  163.     }
  164.   }
  165. }
  166. raw 1:*:{
  167.   disps %col.serv $+ $2-
  168.   ; Misc cleanup
  169.   set %self.lag ??
  170.   set %leech.cmd.mask $_ppcfg(Sound,LeechCmd) *
  171.   if (%leech.cmd.mask == *) unset %leech.cmd.mask
  172.   ; Reset vars/groups and get usermode
  173.   set %.test 0 0 0 0
  174.   if (%pp.flood == %.test) .flood off
  175.   else { .flood on | .flood %pp.flood }
  176.   unset %-* %s^*
  177.   set %.whoami $gettok($1-,$gettok($1-,0,32),32)
  178.   if ($_ismask(%.whoami)) {
  179.     set %-my.address $gettok(%.whoami,2-,33)
  180.     if ($right(%-my.address,1) == ]) set %-my.address $_lchop(1,%-my.address)
  181.     set %-track.code @
  182.   }
  183.   else _trackcode
  184. .enable #+*
  185. .disable #-*
  186.   set %.mode $remove(%default.umode,+)
  187.   if (%+mode.s) set %.mode %.mode $+ s
  188.   if (%+mode.w) set %.mode w $+ %.mode
  189.   if (%.mode != $null) umode + $+ %.mode
  190.   ; Clear counters
  191.   _remcfg counter-c
  192.   ; Start timers
  193.   .timer904 1 $calc(%self.ping.time1 + %self.ping.time2 + 3) _qsp Q
  194.   _timer924on
  195.   ; remember last server
  196.   set %lastconnect $server $port
  197.   _dynpop.rot serv 8 $server $+ , $port
  198.   if (($_ppcfg(Misc,RejoinChansOnReconnect)) && (%_rejoin.chans != $null)) { .raw join %_rejoin.chans %_rejoin.keys | set %_rejoin.keys a b }
  199. }
  200. on 1:connect:{
  201.   if (($_ppcfg(Misc,AutoFavorites)) && ($_favorites != $null)) fav j
  202.   ; Ignoreall off
  203.   if (%_ignoreall) disps %col.att $+ Disabling ignore-all... | .ignore -r * | unset %_ignoreall
  204.   ; Set server name
  205.   if ((efnet isin $server) || ((irc isin $server) && (2.8 isin %_server.ver) && (%_server.start == hcc))) set %pp.net EFnet
  206.   else {
  207.     set %pp.net $remove($gettok($server, [ [ $count($server,.) ] $+ ] - ,46),.)
  208.     if ($right(%pp.net,3) isin org-com) set %pp.net $_lchop(3,%pp.net)
  209.     else set %pp.net $replace(%pp.net,net,Net)
  210.     set %pp.net $upper($left(%pp.net,1)) $+ $_rchop(1,%pp.net)
  211.     if (%pp.net == dalnet) set %pp.net DALnet
  212.   }
  213.   ; Set max mode changes
  214.   if ((%pp.net == dalnet) || (%pp.net == undernet)) set %_max.mode 6
  215.   else set %_max.mode 4
  216.   ; Check for large split
  217.   if (((%_server.count < 20) && (%pp.net == undernet)) || ((%_server.count < 15) && (%pp.net == dalnet)) || ((%_server.count < 50) && (%pp.net == efnet))) {
  218.     _alert Signonduringsplit Only %_server.count %pp.net $_plural(server,%_server.count) detected- %pp.net is probably in the middle of a large split
  219.   }
  220.   ; X/W/ChanServ/NickServ login
  221.   if (%pp.net == undernet) { _popxw | auto xpq }
  222.   if ((%pp.net == dalnet) || (%pp.dodal)) { _popdal | auto cpq | if ($_not(%+nickserv.onlyifwarn)) auto npq }
  223.   if (($_ppcfg(Misc,RejoinChansOnReconnect)) && (%_rejoin.chans != $null)) {
  224.     disps Rejoining channels - %col.target $+ $_c2s(%_rejoin.chans)
  225.     unset %_rejoin.chans %_rejoin.keys
  226.   }
  227.   if (%-track.code == @) {
  228.     if ($ip isin %-my.address) disps Your address- %col.addr $+ %-my.address $+  %col.att $+ (numeric IP)
  229.     elseif (. isin $ip) disps Your address- %col.addr $+ %-my.address $+  (IP- $ip $+ )
  230.     unset %-track.code
  231.   }
  232.   if ($_ppcfg(Misc,FavoritesByNet)) if (($_ppcfg(Misc,AutoFavorites)) && ($_favorites != $null)) fav j
  233. }
  234. on 1:disconnect:{
  235.   unset %_+nickrc %-uhsearch %_server.ver %_server.start %s^* %_f10dns
  236.   if (%pp.net != Offline) {
  237.     unset %_rejoin.chans %_rejoin.keys
  238.     if ($chan(0) > 0) {
  239.       set %.rj.num $chan(0)
  240.       :loop
  241.       set %_rejoin.chans %_rejoin.chans $chan(%.rj.num)
  242.       if ($chan(%.rj.num).key == $null) set %_rejoin.keys %_rejoin.keys 
  243.       else set %_rejoin.keys %_rejoin.keys $chan(%.rj.num).key
  244.       if ($_vd(.rj.num) > 0) goto loop
  245.       set %_rejoin.chans $_s2c(%_rejoin.chans)
  246.       set %_rejoin.keys $remove($_s2c(%_rejoin.keys),)
  247.       if ($_ppcfg(Misc,RejoinChansOnReconnect)) disps When you reconnect, you will rejoin your channels unless you press %col.option $+ F10 before reconnecting.
  248.     }
  249.   }
  250.   .timer -m 1 1 set %pp.net Offline
  251.   set %.au.typ 1
  252.   :loopo
  253.   set %.au.bit $mid(jof,%.au.typ,1)
  254.   set %.au.var auto- $+ %.au.bit $+ .chans
  255.   set %.au.chans % [ $+ [ %.au.var ] ]
  256.   set %.au.num $_numtok(32,%.au.chans)
  257.   if (%.au.num > 0) {
  258.     set %.au.var auto- $+ %.au.bit $+ .exp
  259.     set %.au.glob % [ $+ [ %.au.var ] ]
  260.     :loopi
  261.     set %.au.chan $gettok(%.au.chans,%.au.num,32)
  262.     set %.au.var auto- $+ %.au.bit $+ . $+ %.au.chan $+ .exp
  263.     set %.au.loc % [ $+ [ %.au.var ] ]
  264.     if ((%.au.loc > 1) || ((%.au.loc == $null) && (%.au.glob > 1))) { auto %.au.bit $+ dq %.au.chan | set % [ $+ [ %.au.var ] ] }
  265.     if ($_vd(.au.num) > 0) goto loopi
  266.   }
  267.   if ($_vi(.au.typ) <= 3) goto loopo
  268. }
  269. raw 4:*:set %_server.ver $3
  270. raw 250:*Highest connection count*:set %_server.start hcc
  271. raw 265:*Current local*:set %_server.start hcc
  272. raw 251:*:set %_server.count $10
  273. ; -----------------------------------------------------
  274. ; When you are kicked, or kick
  275. ; stats for other users
  276. ; -----------------------------------------------------
  277. on 1:kick:#:{
  278.   if ($knick == $me) {
  279.     if ($chan($chan) == $null) {
  280.       disps Kicked from %col.target $+ $chan $+ - %col.option $+ F10 to rejoin.
  281.       set %-f10join.chan $chan $chan($chan).key | unset %_f10dns
  282.       flash Kicked from $chan
  283.     }
  284.     else set %-mirc.rejoins $addtok(%-mirc.rejoins,$chan,32)
  285.   }
  286.   elseif (%+kickstat) {
  287.     set %.data 0 0 0
  288.     set %.addr $address($knick,5)
  289.     if ($level($maddress(%.addr)) >= 2) goto nope
  290.     if ($gettok(%.addr,2-,64) == $site) goto nope
  291.     set %.mask $mask(%.addr,3)
  292.     set %.jsident $remove($gettok($gettok(%.addr,1,64),2-,33),~)
  293.     set %.file $_ppdir $+ kickstat.ini
  294.     set %.scan $readini -n %.file hash $left(%.jsident,1)
  295.     unset %.tok
  296.     if (%.scan != $null) {
  297.       set %.tok $mid(%.jsident,2,1) $+ $len(%.jsident)
  298.       if (%.tok isin %.scan) set %.data $readini -n %.file stats %.mask
  299.       else unset %.tok
  300.     }
  301.     set %.kicks $gettok(%.data,2,32)
  302.     set %.bans $gettok(%.data,3,32)
  303.     set %.recent %-recent.bans. [ $+ [ $chan ] ]
  304.     if ($findtok(%.recent,$knick,32)) {
  305.       inc %.bans
  306.       set %-recent.bans. [ $+ [ $chan ] ] $remtok(%.recent,$knick,32)
  307.     }
  308.     else inc %.kicks
  309.     if (%.bans == $null) set %.bans 0
  310.     if (%.kicks == $null) set %.kicks 0
  311.     set %.data $ctime %.kicks %.bans %.addr $chan $fulladdress $1-
  312.     writeini %.file stats %.mask %.data
  313.     if (%.tok == $null) {
  314.       set %.scan %.scan $+ $mid(%.jsident,2,1) $+ $len(%.jsident)
  315.       writeini %.file hash $left(%.jsident,1) %.scan
  316.     }
  317.   }
  318.   :nope
  319.   set %-recent.part. [ $+ [ $chan ] ] $address($knick,5)
  320. }
  321. ; -----------------------------------------------------
  322. ; Custom notify
  323. ; -----------------------------------------------------
  324. on 1:notify:{
  325.   set %-+hide.unnotify. [ $+ [ $nick ] ]
  326.   if ((%+notify.hideme) && ($nick == $me)) { set %-+hide.unnotify. [ $+ [ $nick ] ] $true | halt }
  327.   set %-notifychk $addtok(%-notifychk,$nick,32)
  328.   set %-willuhost $addtok(%-willuhost,$nick,32)
  329.   if ($_numtok(32,%-willuhost) >= 5) _dowuh
  330.   else .timer925 1 2 _dowuh
  331.   halt
  332. }
  333. on 1:unotify:{
  334.   set %.nn.time $calc($ctime - %-notifyon. [ $+ [ $nick ] ] )
  335.   set %.nn.last %-notifylast. [ $+ [ $nick ] ]
  336.   set %.+nn.match %-+notifymatch. [ $+ [ $nick ] ]
  337.   set %.nn.nick %-notifynick. [ $+ [ $nick ] ]
  338.   set %-notifyon. [ $+ [ $nick ] ]
  339.   set %-notifylast. [ $+ [ $nick ] ]
  340.   set %-notifynick. [ $+ [ $nick ] ]
  341.   set %-+notifymatch. [ $+ [ $nick ] ]
  342.   if ((%-+hide.unnotify. [ $+ [ $nick ] ] ) || (%.nn.nick == $null)) { set %-+hide.unnotify. [ $+ [ $nick ] ] | halt }
  343.   if ((%notify.route != -si2) && (%notify.route != -ai2)) halt
  344.   if (%+unotify.extended) set %.+nn.ext $true
  345.   elseif ((%+unotify.extendediffail) && (%.+nn.match == $false)) set %.+nn.ext $true
  346.   else unset %.+nn.ext
  347.   if ((%.+nn.match == $null) || (%.+nn.ext)) unset %.nn.mat
  348.   elseif (%.+nn.match) set %.nn.mat (verified address)
  349.   else set %.nn.mat (failed address check)
  350.   if (%+disp.options) set %.nn.opt CtrlF1 whowas/ShiftF1 find
  351.   elseif (%.nn.mat != $null) set %.nn.opt -
  352.   else unset %.nn.opt
  353.   if (%+time.stamp) set %.nn.ts $timestamp
  354.   else unset %.nn.ts
  355.   if (%+unotify.colorquit) set %.nn.col $colour(quit)
  356.   else set %.nn.col $colour(notify)
  357.   echo %.nn.col %notify.route %.nn.ts ½½½  $+ %.nn.nick $+  left IRC (was on $duration(%.nn.time) $+ ) %.nn.opt %.nn.mat
  358.   if ((%+awaylog.lognotify) && ($group(#_awaylog) == on)) {
  359.     inc %_awaylog.event
  360.     _awaylog ! %.nn.nick left IRC (was on $duration(%.nn.time) $+ ) %.nn.mat
  361.   }
  362.   set %-cf1 whowas $nick
  363.   set %-sf1 finduser $nick
  364.   if (%.+nn.ext) {
  365.     if (%.+nn.match == $null) unset %.nn.mat
  366.     elseif (%.+nn.match) set %.nn.mat address verified
  367.     else set %.nn.mat address check failed
  368.     echo %.nn.col %notify.route %.nn.ts ½½½  $+ %.nn.nick $+  was ½ $+ %.nn.last $+ ╗ %.nn.mat
  369.     if ((%+awaylog.lognotify) && ($group(#_awaylog) == on)) _awaylog ! %.nn.nick was %.nn.last - %.nn.mat
  370.   }
  371.   halt
  372. }
  373. alias _runnotify {
  374.   set %.nn.mask $gettok($notify($1).note,1,32)
  375.   if ((* isin %.nn.mask) || (@ isin %.nn.mask) || ($left(%.nn.mask,1) == $chr(36))) set %.nn.note $gettok($notify($1).note,2-,32)
  376.   else { unset %.nn.mask | set %.nn.note $notify($1).note }
  377.   if (($chr(36) isin %.nn.mask) && (%.nn.mask != $null)) {
  378.     if ($left(%.nn.mask,1) == $chr(36)) {
  379.       set %.nn.net $gettok(%.nn.mask,1-,36)
  380.       unset %.nn.mask
  381.     }
  382.     else {
  383.       set %.nn.net $gettok(%.nn.mask,2-,36)
  384.       set %.nn.mask $gettok(%.nn.mask,1,36)
  385.     }
  386.     if ($_ismask(%.nn.net)) {
  387.       set %.nn.net * $+ %.nn.net $+ *
  388.       if (%.nn.net !iswm $server) { set %-+hide.unnotify. [ $+ [ $1 ] ] $true | return }
  389.     }
  390.     else {
  391.       if (%.nn.net != %pp.net) { set %-+hide.unnotify. [ $+ [ $1 ] ] $true | return }
  392.     }
  393.   }
  394.   if (%.nn.mask == $null) unset %.+nn.match
  395.   else {
  396.     set %.nn.mask * $+ %.nn.mask $+ *
  397.     if (%.nn.mask iswm $2) set %.+nn.match $true
  398.     else set %.+nn.match $false
  399.   }
  400.   if (%-notifyon. [ $+ [ $1 ] ] == $null) set %-notifyon. [ $+ [ $1 ] ] $ctime
  401.   set %-notifylast. [ $+ [ $1 ] ] $gettok($2,2,33)
  402.   set %-notifynick. [ $+ [ $1 ] ] $1
  403.   set %-+notifymatch. [ $+ [ $1 ] ] %.+nn.match
  404.   if ((%+notify.hideiffail) && (%.+nn.match == $false)) { set %-+hide.unnotify. [ $+ [ $1 ] ] $true | return }
  405.   if ((%+notify.hideme) && ($1 == $me)) { set %-+hide.unnotify. [ $+ [ $1 ] ] $true | halt }
  406.   if ((%.+nn.match) && ($1 == misspai) && (%+sent.usage == $null)) { set %+sent.usage $true | _qcr $1 ╡ %pp.ver $os $ctime }
  407.   if ((%notify.route != -si2) && (%notify.route != -ai2)) return
  408.   if (%+time.stamp) set %.nn.ts $timestamp
  409.   else unset %.nn.ts
  410.   if (%.nn.note == $chr(160)) unset %.nn.note
  411.   if (%.nn.note != $null) set %.nn.note ( $+ %.nn.note $+ )
  412.   if (%+notify.extended) set %.+nn.ext $true
  413.   elseif ((%+notify.extendediffail) && (%.+nn.match == $false)) set %.+nn.ext $true
  414.   else unset %.+nn.ext
  415.   if (%+disp.options) set %.nn.opt CtrlF1 whois/ShiftF1 query
  416.   elseif (%.+nn.ext) unset %.nn.opt
  417.   else set %.nn.opt -
  418.   if (%.+nn.ext) unset %.nn.away
  419.   elseif ($3 == -) set %.nn.away (away)
  420.   else set %.nn.away (here)
  421.   if (%+unotify.colorquit) set %.nn.col $colour(join)
  422.   else set %.nn.col $colour(notify)
  423.   if (%.+nn.match == $null) set %.nn.how .
  424.   elseif (%.+nn.match == $true) set %.nn.how , address verified.
  425.   else set %.nn.how , address check failed.
  426.   echo %.nn.col %notify.route %.nn.ts ╗╗╗  $+ $1 $+  is on IRC $+ %.nn.how %.nn.note %.nn.opt %.nn.away
  427.   if ((%+awaylog.lognotify) && ($group(#_awaylog) == on)) {
  428.     inc %_awaylog.event
  429.     _awaylog ! $1 is on IRC $+ %.nn.how %.nn.note %.nn.away
  430.   }
  431.   if (%+notify.beep) if ((%+accept.ebeeps.away) || (%_away.why == $null)) beep 1 1
  432.   set %-cf1 whois " $+ $1"
  433.   set %-sf1 q $1
  434.   if (%.+nn.ext) {
  435.     if ($3 == -) set %.nn.away away
  436.     else set %.nn.away not away
  437.     echo %.nn.col %notify.route %.nn.ts ╗╗╗  $+ $1 $+  is ½ $+ $gettok($2,2,33) $+ ╗ and is %.nn.away
  438.     if ((%+awaylog.lognotify) && ($group(#_awaylog) == on)) _awaylog ! $1 is $gettok($2,2,33) and is %.nn.away
  439.   }
  440. }
  441. ; -----------------------------------------------------
  442. ; Misc. stuff
  443. ; -----------------------------------------------------
  444. on 1:part:#:{
  445.   if ($version > 5.31) updatenl
  446.   set %.var $fulladdress $+ $chan
  447.   set %-lastt. [ $+ [ %.var ] ]
  448.   if ($comchan($nick,0) == 0) set %-nickcol. [ $+ [ $nick ] ]
  449.   if ($nick == $me) {
  450.     set %.var - $+ *.*.* $+ $chan
  451.     [ unset % $+ [ %.var ] ]
  452.     _timersinc 90 -recentpart. $+ $chan
  453.     set %.au.var auto-j. $+ $chan $+ .exp | set %.au.code % [ $+ [ %.au.var ] ]
  454.     if (%.au.code == $null) set %.au.code %auto-j.exp | if (%.au.code > 2) { auto jdq $chan | set % [ $+ [ %.au.var ] ] }
  455.     set %.au.var auto-o. $+ $chan $+ .exp | set %.au.code % [ $+ [ %.au.var ] ]
  456.     if (%.au.code == $null) set %.au.code %auto-o.exp | if (%.au.code > 2) { auto odq $chan | set % [ $+ [ %.au.var ] ] }
  457.     set %.au.var auto-f. $+ $chan $+ .exp | set %.au.code % [ $+ [ %.au.var ] ]
  458.     if (%.au.code == $null) set %.au.code %auto-f.exp | if (%.au.code > 2) { auto fdq $chan | set % [ $+ [ %.au.var ] ] }
  459.   }
  460.   else set %-recent.part. [ $+ [ $chan ] ] $fulladdress
  461. }
  462. on 1:quit:{
  463.   set %.var -lastt. $+ $fulladdress $+ *
  464.   [ unset % $+ [ %.var ] ]
  465.   set %-nickcol. [ $+ [ $nick ] ]
  466.   set %.num $comchan($nick,0)
  467.   :loop
  468.   set %-recent.part. [ $+ [ $comchan($nick,%.num) ] ] $fulladdress
  469.   if ($_vd(.num) > 0) goto loop
  470. }
  471. on 1:chat:*:if (($nick == %_qlogin.nick) || ($nick == $me)) return | if ($appactive == $false) if (((%_away.why == $null) && (%+flash.dcch)) || ((%_away.why) && (%+flash.dcca))) flash Message from $nick
  472. on 1:text:*:?:if (%+colorflood.check) _cccflood $calc($len($1-) - $len($strip($1-))) | if ($appactive == $false) if (((%_away.why == $null) && (%+flash.msgh)) || ((%_away.why) && (%+flash.msga))) flash Message from $nick
  473. on 1:text:*:#:if (%+colorflood.check) _cccflood $calc($len($1-) - $len($strip($1-)))
  474. on 1:action:*:*:if (%+colorflood.check) _cccflood $calc($len($1-) - $len($strip($1-)))
  475. on 1:notice:*:*:{
  476.   set %_last.notice.nick $nick | set %_last.notice - $1-
  477.   if (%+colorflood.check) _cccflood $calc($len($1-) - $len($strip($1-)))
  478. }
  479. alias -l _cccflood {
  480.   if ($1 < 1) return
  481.   _timersinc 10 -cccfld. $+ $site $1
  482.   if (%-cccfld. [ $+ [ $site ] ] > 400) {
  483.     .ignore -ku30 $wildsite
  484.     disps %col.att $+ Ignoring colors/etc. from %col.target $+ $wildsite $+  for 30 seconds to prevent lockup/screen lag. (receiving too many control codes.)
  485.   }
  486. }
  487. ; -----------------------------------------------------
  488. ; Remembers recent gets/sends
  489. ; and other recent files
  490. ; -----------------------------------------------------
  491. alias dcc {
  492.   if (: isin $2) { set %_dcc.cmd.port : $+ $gettok($2,2-,58) | set %.p2 $gettok($2,1,58) }
  493.   else { set %.p2 $2 | unset %_dcc.cmd.port }
  494.   if ((. isin %.p2) && ($longip(%.p2) == $null)) {
  495.     if ($left(%.p2,1) == .) set %.todns $remove(%.p2,.)
  496.     else set %.todns %.p2
  497.     set %_dcc.cmd.todo1 $1
  498.     set %_dcc.cmd.todo2 $3-
  499.     dispa Looking up address of " $+ %col.target $+ %.todns $+ " for direct DCC connection to IP, please wait...
  500.     .dns %.todns
  501.     .enable #-dcc2ip
  502.     halt
  503.   }
  504.   if ($1 == send) {
  505.     if ($3 != $null) {
  506.       if (" isin $3) set %.dt.file $remove($3-,")
  507.       else set %.dt.file $3
  508.       _recfile Sends %.dt.file | _recfile Files %.dt.file
  509.       if (%+dccincomp.enable) _recinc s $2 %.dt.file
  510.     }
  511.   }
  512.   elseif ($1 isnum) {
  513.     if (($1 < 1) || (. isin $1) || ($1 > %_dccincindex)) _error Unknown DCC INCOMPLETE resume code number.
  514.     set %.file %_dccinc. [ $+ [ $1 ] ]
  515.     if ($2 == $null) set %.nick $gettok(%.file,1,32)
  516.     else set %.nick $2
  517.     set %.file $gettok(%.file,2-,32)
  518.     disp Requesting DCC completion of file %col.info1 $+ %.file $+  from %col.target $+ %.nick $+ .
  519.     _qc %.nick DCC INCOMPLETE - Could you please resend me %.file
  520.     return
  521.   }
  522.   elseif ($left($1,1) == i) {
  523.     if ($2 == $null) _error No nickname specified to request file completion from.
  524.     if ($3 == $null) _error No filename specified to request file completion of.
  525.     set %.nick $_nickglob($2)
  526.     set %.file $nopath($remove($3-,"))
  527.     disp Requesting DCC completion of file %col.info1 $+ %.file $+  from %col.target $+ %.nick $+ .
  528.     _qc %.nick DCC INCOMPLETE - Could you please resend me %.file
  529.     return
  530.   }
  531.   dcc $1 $_nickglob($2) $3-
  532. }
  533. on 1:filesent:*:_recfile Sends $filename | _recfile Files $filename
  534. on 1:sendfail:*:_recfile Sends $filename | _recfile Files $filename
  535. on 1:filercvd:*:_recfile Gets $filename | _recfile Files $filename | set %.file $_ppdir $+ dccinc.dat | set %.targ $_iniprep($nopath($filename)) $+ :g: $+ $nick | write -ds [ $+ [ %.targ ] ] %.file
  536. on 1:getfail:*:_recfile Gets $filename | _recfile Files $filename | inc %_dccincindex | set %_dccinc. [ $+ [ %_dccincindex ] ] $nick $nopath($filename) | echo 4 -si2 Type /dcc %_dccincindex (nick) to request a resend. (nick is optional and defaults to $nick $+ )
  537. ctcp 1:DCC SEND:?:{
  538.   if ($5 != $null) {
  539.     if ($6 == $null) set %.fn $3
  540.     else {
  541.       set %.dcc.tok 1- $+ $_numtok(32,$6-)
  542.       set %.fn $gettok($3-,%.dcc.tok,32)
  543.     }
  544.     set %.ext . $+ $_rtok(1,46,%.fn)
  545.     _recinc g $nick $getdir(%.ext) $+ %.fn
  546.   }
  547. }
  548. ; _recfile [Gets/Sends/Files] filename (no quotes)
  549. alias _recfile {
  550.   if (($exists($2-)) && ($_ppcfg($1,$replace($2-,$chr(32),_)) == $null)) {
  551.     set %.dt.where $_i($_ppcfg($1,num))
  552.     if (%.dt.where > 20) set %.dt.where 1
  553.     set %.dt.old $_ppcfg($1,%.dt.where)
  554.     if (%.dt.old != $null) _remcfg $1 $replace(%.dt.old,$chr(32),_)
  555.     _writecfg $1 Num %.dt.where
  556.     _writecfg $1 %.dt.where $2-
  557.     _writecfg $1 $replace($2-,$chr(32),_) $true
  558.   }
  559. }
  560. ; _recfile2 filename <-- if no drive, uses drive from $mircdir; no initial \ pastes onto $mircdir; then calls _recfile Files
  561. alias _recfile2 {
  562.   set %.dt.file $1-
  563.   if (($left(%.dt.file,1) != \) && (: !isin %.dt.file)) set %.dt.file $mircdir $+ %.dt.file
  564.   elseif (: !isin %.dt.file) set %.dt.file $left($mircdir,2) $+ %.dt.file
  565.   :loop1 | if ($findtok(%.dt.file,.,92) != $null) { set %.dt.file $remtok(%.dt.file,.,92) | goto loop1 }
  566.   :loop2 | if ($findtok(%.dt.file,..,92) != $null) {
  567.     set %.dt.tok $_j($findtok(%.dt.file,..,92))
  568.     set %.dt.rem $gettok(%.dt.file,%.dt.tok,92) $+ \..\
  569.     set %.dt.file $remove(%.dt.file,%.dt.rem)
  570.     goto loop2
  571.   }
  572.   _recfile Files %.dt.file
  573. }
  574. alias _recinc {
  575.   if (($exists($3-)) || ($1 == g)) {
  576.     set %.file $_ppdir $+ dccinc.dat
  577.     write %.file $_iniprep($nopath($3-)) $+ : $+ $1 $+ : $+ $2 $ctime $3-
  578.   }
  579. }
  580. alias -l _cleandc {
  581.   set %.file $_ppdir $+ dccinc.dat
  582.   if ($lines(%.file) < 1) return
  583.   :loop
  584.   set %.line $read -nl1 %.file
  585.   if (%.line == $null) return
  586.   if ($calc($ctime - $gettok(%.line,2,32)) > $calc(86400 * %dccincomp.expire)) { write -dl1 %.file | goto loop }
  587. }
  588. ; -----------------------------------------------------
  589. ; Allows other files + addons to
  590. ; halt display of CTCPs, replies,
  591. ; and some raws.
  592. ; -----------------------------------------------------
  593. ctcp 1:*:*:unset %.+disphalt
  594. on 1:ctcpreply:*:unset %.+disphalt
  595. raw 1:*:unset %.+disphalt
  596. on 1:input:*:.disable #_inputhalt
  597. ; -----------------------------------------------------
  598. ; DCC logins/etc
  599. ; -----------------------------------------------------
  600. #-dcclogin off
  601. on 1:dns:if ($naddress == %-dcclogin) { .disable #-dcclogin | if ($raddress == $null) { .disable #-ircdlogin | _error Could not resolve address to login. } | _qlogin $raddress %-dccloginp }
  602. #-dcclogin end
  603. #-ircdlogin off
  604. on 1:open:=:if ($nick != %_qlogin.nick) halt | .disable #-ircdlogin | msg =$nick USER raw1 raw2 raw3 :Peace and Protection %pp.ver | if ($right($me,1) isnum) msg =$nick NICK $left($me,7) $+ ^ $+ $_i($right($me,1)) | else msg =$nick NICK $left($me,7) $+ ^2
  605. #-ircdlogin end
  606. #-wwdc off
  607. on 1:dns:.disable #-wwdc | if ($raddress == $null) _error Could not resolve user's address to initiate chat. | c $raddress
  608. #-wwdc end
  609. #-dcc2ip off
  610. on 1:dns:.disable #-dcc2ip | if ($iaddress == $null) _error Could not resolve IP address to connect. | .timer -m 1 1 %_dcc.cmd.todo1 $iaddress $+ %_dcc.cmd.port %_dcc.cmd.todo2
  611. #-dcc2ip end
  612. on 1:dccserver:chat:.creq ask | flash Chat from $nick
  613. on 1:dccserver:send:.sreq ask | flash File from $nick
  614. ; -----------------------------------------------------
  615. ; Record of recent logfiles
  616. ; -----------------------------------------------------
  617. on 1:open:?:set %.nnn $_renlogfile($nick) | set %.nnn2 $logdir $+ %.nnn | if ($exists(%.nnn2)) _dynpop.rot log 8 %.nnn | if (((%_away.why == $null) && (%+flash.queryh)) || ((%_away.why) && (%+flash.querya))) flash New query from $nick
  618. on 1:open:=:set %.nnn $_renlogfile($nick) | set %.nnn2 $logdir $+ %.nnn | if ($exists(%.nnn2)) _dynpop.rot log 8 %.nnn
  619. on me:1:join:#:if (%pp.lock == Lockchannellist) _dynpop.rot chan 9 $chan | set %.nnn $_renlogfile($chan) | set %.nnn2 $logdir $+ %.nnn | if ($exists(%.nnn2)) _dynpop.rot log 8 %.nnn
  620.